|
|
|
|
|
|
|
The Solid3d class represents a solid made up of Face3d objects. It stores the Face3d objects in a collection. Most of the Solid3d's routines simply pass requests on to the solid's polygons. For example, the solid's Cull subroutine invokes each polygon's Cull routine. |
|
|
|
 |
|
|
|
|
Public Faces As Collection
' Perform backface removal on the faces for
' center of projection at (X, Y, Z). Public Sub Cull(ByVal X As Single, ByVal Y As Single, _
ByVal Z As Single)
Dim obj As Face3d
For Each obj In Faces
obj.Cull X, Y, Z
Next obj
End Sub |
|
|
|
|
|
|
|
|
Example program Backface, shown in Figure 15.5, uses the Solid3d and Face3d classes to demonstrate backface removal. Use the option buttons to display different solids. Use the check box to indicate whether the program should perform backface removal. |
|
|
|
|
|
|
|
|
The first six solids are convex, so hidden surface removal displays them with all hidden surfaces correctly removed. The last three scenes are not convex solids, so hidden surface removal is not enough. If you view these scenes at certain angles, you can still see some lines that should be hidden. |
|
|
|
|
|
|
|
|
Figure 15.6 shows two situations in which backface removal does not remove all the hidden surfaces. The pictures on the top show the results of backface removal. The pictures on the bottom show the correct images with all hidden surfaces removed. The stellate octahedron on the left is not convex, so some faces partially obscure others. The picture on the right contains several different convex solids. Some of the solids obscure |
|
|
|
|
|
|
|
|
Figure 15.5
Program Backface displays solids with backface removal. |
|
|
|
|
|